﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Models;
using SqlSugar;
namespace DAL
{
    public class D_Teacher
    {


        public bool login(Teacher m_teacher)
        {

            var teachers = SqlSugarHelper.Db.Queryable<Teacher>().Where(t => t.teacher_uname == m_teacher.teacher_uname && t.pwd == m_teacher.pwd).ToList();
            if (teachers.Count == 0) return false;

            LogInfo.Server_Time = SqlSugarHelper.Db.GetDate();

            LogInfo.teacher = teachers[0];
            var sys_config = SqlSugarHelper.Db.Queryable<Sys_config>().ToList();

            if (sys_config.Count > 0)
            {
                LogInfo.Sys_Config.tearch_choice = sys_config[0].tearch_choice;
                LogInfo.Sys_Config.group_choice = sys_config[0].group_choice;
            }
            return true;
        }
        public List<Teacher> getList()
        {
            var list = SqlSugarHelper.Db.Queryable<Teacher>().ToList();
            return list;
        }
    }

}
